package edu.zut.software.identity.Repository;
import edu.zut.software.identity.domain.StuMajor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface StuMajorRepository extends JpaRepository<StuMajor,Object>, JpaSpecificationExecutor<StuMajor> {
    @Query(value = "select\n"+
            "stu_major.id,stu_major.name,stu_major.college_id,stu_major.college_name,stu_major.px,stu_major.college_id,stu_major.wx_id\n" +
            "    from stu_major\n" +
            "    left join stu_college college on stu_major.college_id = college.id\n" +
            "where stu_major.college_id=?1",nativeQuery = true)
    List<StuMajor> getMajorInfoByCollegeId(@Param("Id") String Id);
}
